package com.example.onlinemusicserver2024.controller;

import com.example.onlinemusicserver2024.common.R;
import com.example.onlinemusicserver2024.model.request.AdminRequest;
import com.example.onlinemusicserver2024.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class AdminController {

    @Autowired
    AdminService adminService;

    /**
     * 用于管理端的登录
     *
     * @param adminRequest
     * @param session
     * @return
     */
    @PostMapping("/admin/login/status")
    public R loginStatus(@RequestBody AdminRequest adminRequest, HttpSession session) {
        System.out.println("登录信息：" + adminRequest.getUsername() + "," + adminRequest.getPassword());
        // 调用服务层， 完成登录的功能
        R result = adminService.verityPasswd(adminRequest, session);

        return result;
    }
}
